﻿using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SmartCity.Shared;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;

namespace ParkManagement
{
    /// <summary>
    /// 停车场控制器
    /// </summary>
    [Authorize]
    [RemoteService]
    [Area("commonManagement")]
    [Route("api/parkManagement/lots")]
    public class LotController : AbpController, ILotAppService
    {
        private readonly ILotAppService _lotAppService;

        public LotController(
            ILotAppService lotAppService)
        {
            _lotAppService = lotAppService;
        }

        // 分页列表
        [HttpGet]
        [Route("list")]
        public Task<ListResponse<LotDto>> PagedListAsync(PagedListRequest request, string address, string open, string parkName)
        {
            return _lotAppService.PagedListAsync(request, address, open, parkName);
        }

        // 详情
        [HttpGet]
        [Route("{id:int}")]
        public Task<ResultResponse<LotDto>> GetAsync(int id)
        {
            return _lotAppService.GetAsync(id);
        }
    }
}